﻿namespace DimensionsHelper.ExcelAddIn.Core.Sql;

/// <summary>
/// SQL脚本生成器的数据表格设置类
/// </summary>
public class DataTableSettings
{
    /// <summary>
    /// 保留的小数位数
    /// </summary>
    public int DecimalPlaces { get; set; }

    /// <summary>
    /// 是否显示百分比
    /// </summary>
    public bool AddPercentage { get; set; }

    /// <summary>
    /// 工作表名称
    /// </summary>
    public string ResultPageName { get; set; } = "SQL_TABLE";


    public DataTableSettingsTransmission Transmit()
    {
        return new DataTableSettingsTransmission
        {
            DecimalPlaces = DecimalPlaces,
            AddPercentage = AddPercentage,
            ResultPageName = ResultPageName
        };
    }

    public void Join(DataTableSettingsTransmission transmission)
    {
        DecimalPlaces = transmission.DecimalPlaces;
        AddPercentage = transmission.AddPercentage;

        if (!string.IsNullOrEmpty(transmission.ResultPageName))
        {
            ResultPageName = transmission.ResultPageName;
        }
    }
}